package com.pubinfo.passbook.api.controller.auth;

import com.pubinfo.passbook.common.entity.TRuleChargeGenera;
import com.pubinfo.passbook.common.model.dto.rule.RuleChargeGeneraParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.TRuleChargeGeneraService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("chargeGenera/manager")
@Api(tags = "收费大类管理")
public class TChargeGeneraController {
  
  @Resource
  private TRuleChargeGeneraService generaService;
  
  @PostMapping("select")
  @ApiModelProperty("查询收费大类")
  public JsonResult<MyPage<TRuleChargeGenera>> selectChargeGenera(@RequestBody RuleChargeGeneraParam param) {
    return JsonResult.success(new MyPage(generaService.selectChargeGenera(param)));
  }
  
  @DeleteMapping("remove")
  @ApiModelProperty("删除收费大类")
  public JsonResult<String> removeChargeGenera(String id) {
    return generaService.deleteChargeGenera(id);
  }
  
  @PostMapping("save")
  @ApiModelProperty("新增收费大类")
  public JsonResult<String> saveChargeGenera(@RequestBody TRuleChargeGenera genera) {
    return generaService.saveChargeGenera(genera);
  }
  
  @PostMapping("update")
  @ApiModelProperty("修改收费大类")
  public JsonResult<String> updateChargeGenera(@RequestBody TRuleChargeGenera genera) {
    return generaService.updateChargeGenera(genera);
  }
}
